package com.up.upzl.biz.dto;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Transient;

import org.springframework.util.StringUtils;

import com.up.upzl.base.domain.BaseDomain;
import com.up.upzl.biz.domain.Area;
import com.up.upzl.biz.domain.ShopBusinessType;
import com.up.upzl.biz.domain.ShopSupporting;
import com.up.upzl.biz.domain.ShopTag;
import com.up.upzl.biz.domain.SysAccount;
import com.up.upzl.biz.domain.User;

import lombok.Getter;
import lombok.Setter;

/**
 * 商铺
 * 
 * @author joker
 *
 */

public class ShopDTO implements Serializable{

	private static final long serialVersionUID = 3586785706053144731L;

	/**
	 * 主键
	 */
	private Long id;

	/**
	 * 创建时间
	 */
	private Date createTime;

	/**
	 * 更新时间
	 */
	private Date updateTime;

	/**
	 * 创建时间
	 */
	public void setCreateTime() {
		Date date = new Date();
		createTime = date;
		updateTime = date;
	}

	/**
	 * 更新时间
	 */
	public void setUpdateTime() {
		this.updateTime = new Date();
	}	
	
	private String name;

	/**
	 * 别名（导入数据，防止名称重复导致导入失败）
	 */
	private String nameAlias;

	/**
	 * 排序
	 */
	private Integer sort;

	/**
	 * 是否销售（出售）
	 */
	private Boolean isSale;

	/**
	 * 是否招商（出租）
	 */
	private Boolean isLease;

	/**
	 * 是否转让
	 */
	private Boolean isTransfer;

	/**
	 * 是否热门
	 */
	private Boolean isHot;

	/**
	 * 是否精选
	 */
	private Boolean isAuslese;

	/**
	 * 获取政策类型（销售／招商）
	 * 
	 * @return
	 */
	public String getShopPolicyText() {
		StringBuilder shopPolicy = new StringBuilder();
		if (isSale != null && isSale) {
			shopPolicy.append("销售");
		}
		if (isLease != null && isLease) {
			if (shopPolicy.length() != 0) {
				shopPolicy.append(",");
			}
			shopPolicy.append("招商");
		}
		return shopPolicy.length() == 0 ? "暂无" : shopPolicy.toString();
	}

	/**
	 * 特色标签
	 */
	private List<ShopTag> shopTags;

	/**
	 * 关注人数（整数，单位：人）
	 */
	private Integer followNum;

	/**
	 * 真实关注人数（整数，单位：人）
	 */
	private Integer followNumReal;

	/**
	 * 获取页面显示关注人数
	 * 
	 * @return
	 */
	public Integer getFollowNumTotal() {
		if (followNum == null) {
			followNum = 0;
		}
		if (followNumReal == null) {
			followNumReal = 0;
		}
		return followNum + followNumReal;
	}

	/**
	 * 关注用户
	 */
	private List<User> attentionUser;

	/**
	 * 面积（整数，单位：㎡）
	 */
	private Integer areaMeasure;

	/**
	 * 商铺类型
	 */
	private Type type;

	public enum Type {
		商业街商铺, 社区底商, 写字楼配套, 临街门面, 档口摊位, 购物百货中心
	}

	/**
	 * 总售价（整数，万元）
	 */
	private Integer totalPrice;

	/**
	 * 均售价（整数，元/㎡）
	 */
	private Integer averagePrice;

	/**
	 * 年租金（整数，万元）
	 */
	private Integer yearlyRent;

	/**
	 * 月租金（整数，元/月）
	 */
	private Integer monthlyRent;

	/**
	 * 日租金（2位小数，元/天/㎡）
	 */
	private BigDecimal dailyRent;

	/**
	 * 转让费（1位小数，万元）
	 */
	private BigDecimal transferFee;

	/**
	 * 转让费逻辑
	 */
	public String getTransferFeeText() {
		if (transferFee == null) {
			return null;
		} else if (transferFee.intValue() == -1) {
			return "无";
		} else if (transferFee.intValue() == -2) {
			return "面议";
		} else {
			return transferFee + "万元";
		}
	}

	/**
	 * 市
	 */
	private Area city;

	/**
	 * 城市字符串
	 */
	private String cityText;

	/**
	 * 区
	 */
	private Area area;

	/**
	 * x坐标
	 */
	private String positionX;

	/**
	 * y坐标
	 */
	private String positionY;

	/**
	 * 地址
	 */
	private String address;

	/**
	 * 出售佣金-金牌
	 */
	private String saleGold;

	/**
	 * 出售佣金-银牌
	 */
	private String saleSilver;

	/**
	 * 出售佣金-铜牌
	 */
	private String saleCopper;

	/**
	 * 出租佣金-金牌
	 */
	private String rentGold;

	/**
	 * 出租佣金-银牌
	 */
	private String rentSilver;

	/**
	 * 出租佣金-铜牌
	 */
	private String rentCopper;

	/**
	 * 转让佣金-金牌
	 */
	private String transferGold;

	/**
	 * 转让佣金-银牌
	 */
	private String transferSilver;

	/**
	 * 转让佣金-铜牌
	 */
	private String transferCopper;

	/**
	 * 朝向
	 */
	private String orientation;

	/**
	 * 装修
	 */
	private FloorType floorType;

	public enum FloorType {
		毛坯, 精装, 简装
	}

	/**
	 * 楼层（整数）
	 */
	private Integer floor;

	/**
	 * 总楼层（整数）
	 */
	private Integer totalFloor;

	/**
	 * 层高（1位小数）
	 */
	private BigDecimal floorHeight;

	/**
	 * 面宽（1位小数）
	 */
	private BigDecimal faceWidth;

	/**
	 * 进深（1位小数）
	 */
	private BigDecimal depth;

	/**
	 * 经营现状
	 */
	private Manage manage;

	public enum Manage {
		试营业, 营业中, 空置中
	}

	/**
	 * 配套设施
	 */
	private List<ShopSupporting> shopSupportings;

	/**
	 * 经营业态
	 */
	private List<ShopBusinessType> manageBusinessTypes;

	/**
	 * 适合业态
	 */
	private List<ShopBusinessType> fitBusinessTypes;

	/**
	 * 左临铺-商铺名称
	 */
	private String leftNearName;

	/**
	 * 左临铺-所属业态
	 */
	private List<ShopBusinessType> leftNearBusinessTypes;

	/**
	 * 右临铺-商铺名称
	 */
	private String rightNearName;

	/**
	 * 右临铺-所属业态
	 */
	private List<ShopBusinessType> rightNearBusinessTypes;

	/**
	 * 展示图片
	 */
	private String imgs;

	/**
	 * 展示图片
	 */
	public String[] getImgArray() {
		if (StringUtils.isEmpty(imgs)) {
			return null;
		} else {
			return imgs.split(",");
		}
	}

	/**
	 * 商铺优势
	 */
	private String superiority;

	/**
	 * 商铺状态开关
	 */
	private Status status;

	public enum Status {
		未开启, 开启
	}

	/**
	 * 商铺状态（后台用）
	 */
	private ShopStatus shopStatus;

	public enum ShopStatus {
		有效, 待审, 暂停, 成交, 无效
	}

	/**
	 * 公私盘
	 */
	private PublicType publicType;

	public enum PublicType {
		公盘, 私盘
	}

	/**
	 * 录入人
	 */
	private User inputer;

	private String tel;

	/**
	 * 录入的手机号
	 */
	private String phone;

	/**
	 * 编号
	 */
	private String shopNumber;

	/**
	 * 到期时间
	 */
	private Date dueTime;

	/**
	 * 是否到期
	 */
	public Boolean getDueFlag() {
		if (dueTime == null) {
			return false;
		}
		if (dueTime.getTime() < new Date().getTime()) {
			return true;
		} else {
			return false;
		}
	};

	/**
	 * 业主类型
	 */
	private OwnerType ownerType;

	public enum OwnerType {
		房东, 转让者
	};

	/**
	 * 业主姓名
	 */
	private String ownerName;

	/**
	 * 业主电话
	 */
	private String ownerPhone;

	/**
	 * 业主微信
	 */
	private String ownerWeChat;

	private String sourceName;

	private String areaText;

	/**
	 * 采集数据状态
	 */
	private CrawlerStatus crawlerStatus;

	public enum CrawlerStatus {
		未分配, 已分配, 已核实, 已导入
	}

	/**
	 * 删除
	 */
	private Boolean deleted;

	/**
	 * 商铺创建类型
	 */
	private CreateType createType;

	public enum CreateType {
		后台录入, 采集数据, C端客户
	}

	/**
	 * 核实人账号
	 */
	private SysAccount verificationAccount;

	/**
	 * 分配时间
	 */
	private Date distributionTime;

	public String getNameText() {
		if (StringUtils.isEmpty(name)) {
			return nameAlias;
		} else {
			return name;
		}

	}

	/**
	 * 导入资源地址
	 */
	private String link;

	/**
	 * 浏览标志
	 */
	private Boolean viewFlag;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNameAlias() {
		return nameAlias;
	}

	public void setNameAlias(String nameAlias) {
		this.nameAlias = nameAlias;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public Boolean getIsSale() {
		return isSale;
	}

	public void setIsSale(Boolean isSale) {
		this.isSale = isSale;
	}

	public Boolean getIsLease() {
		return isLease;
	}

	public void setIsLease(Boolean isLease) {
		this.isLease = isLease;
	}

	public Boolean getIsTransfer() {
		return isTransfer;
	}

	public void setIsTransfer(Boolean isTransfer) {
		this.isTransfer = isTransfer;
	}

	public Boolean getIsHot() {
		return isHot;
	}

	public void setIsHot(Boolean isHot) {
		this.isHot = isHot;
	}

	public Boolean getIsAuslese() {
		return isAuslese;
	}

	public void setIsAuslese(Boolean isAuslese) {
		this.isAuslese = isAuslese;
	}

	public List<ShopTag> getShopTags() {
		return shopTags;
	}

	public void setShopTags(List<ShopTag> shopTags) {
		this.shopTags = shopTags;
	}

	public Integer getFollowNum() {
		return followNum;
	}

	public void setFollowNum(Integer followNum) {
		this.followNum = followNum;
	}

	public Integer getFollowNumReal() {
		return followNumReal;
	}

	public void setFollowNumReal(Integer followNumReal) {
		this.followNumReal = followNumReal;
	}

	public List<User> getAttentionUser() {
		return attentionUser;
	}

	public void setAttentionUser(List<User> attentionUser) {
		this.attentionUser = attentionUser;
	}

	public Integer getAreaMeasure() {
		return areaMeasure;
	}

	public void setAreaMeasure(Integer areaMeasure) {
		this.areaMeasure = areaMeasure;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public Integer getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(Integer totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Integer getAveragePrice() {
		return averagePrice;
	}

	public void setAveragePrice(Integer averagePrice) {
		this.averagePrice = averagePrice;
	}

	public Integer getYearlyRent() {
		return yearlyRent;
	}

	public void setYearlyRent(Integer yearlyRent) {
		this.yearlyRent = yearlyRent;
	}

	public Integer getMonthlyRent() {
		return monthlyRent;
	}

	public void setMonthlyRent(Integer monthlyRent) {
		this.monthlyRent = monthlyRent;
	}

	public BigDecimal getDailyRent() {
		return dailyRent;
	}

	public void setDailyRent(BigDecimal dailyRent) {
		this.dailyRent = dailyRent;
	}

	public BigDecimal getTransferFee() {
		return transferFee;
	}

	public void setTransferFee(BigDecimal transferFee) {
		this.transferFee = transferFee;
	}

	public Area getCity() {
		return city;
	}

	public void setCity(Area city) {
		this.city = city;
	}

	public String getCityText() {
		return cityText;
	}

	public void setCityText(String cityText) {
		this.cityText = cityText;
	}

	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

	public String getPositionX() {
		return positionX;
	}

	public void setPositionX(String positionX) {
		this.positionX = positionX;
	}

	public String getPositionY() {
		return positionY;
	}

	public void setPositionY(String positionY) {
		this.positionY = positionY;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getSaleGold() {
		return saleGold;
	}

	public void setSaleGold(String saleGold) {
		this.saleGold = saleGold;
	}

	public String getSaleSilver() {
		return saleSilver;
	}

	public void setSaleSilver(String saleSilver) {
		this.saleSilver = saleSilver;
	}

	public String getSaleCopper() {
		return saleCopper;
	}

	public void setSaleCopper(String saleCopper) {
		this.saleCopper = saleCopper;
	}

	public String getRentGold() {
		return rentGold;
	}

	public void setRentGold(String rentGold) {
		this.rentGold = rentGold;
	}

	public String getRentSilver() {
		return rentSilver;
	}

	public void setRentSilver(String rentSilver) {
		this.rentSilver = rentSilver;
	}

	public String getRentCopper() {
		return rentCopper;
	}

	public void setRentCopper(String rentCopper) {
		this.rentCopper = rentCopper;
	}

	public String getTransferGold() {
		return transferGold;
	}

	public void setTransferGold(String transferGold) {
		this.transferGold = transferGold;
	}

	public String getTransferSilver() {
		return transferSilver;
	}

	public void setTransferSilver(String transferSilver) {
		this.transferSilver = transferSilver;
	}

	public String getTransferCopper() {
		return transferCopper;
	}

	public void setTransferCopper(String transferCopper) {
		this.transferCopper = transferCopper;
	}

	public String getOrientation() {
		return orientation;
	}

	public void setOrientation(String orientation) {
		this.orientation = orientation;
	}

	public FloorType getFloorType() {
		return floorType;
	}

	public void setFloorType(FloorType floorType) {
		this.floorType = floorType;
	}

	public Integer getFloor() {
		return floor;
	}

	public void setFloor(Integer floor) {
		this.floor = floor;
	}

	public Integer getTotalFloor() {
		return totalFloor;
	}

	public void setTotalFloor(Integer totalFloor) {
		this.totalFloor = totalFloor;
	}

	public BigDecimal getFloorHeight() {
		return floorHeight;
	}

	public void setFloorHeight(BigDecimal floorHeight) {
		this.floorHeight = floorHeight;
	}

	public BigDecimal getFaceWidth() {
		return faceWidth;
	}

	public void setFaceWidth(BigDecimal faceWidth) {
		this.faceWidth = faceWidth;
	}

	public BigDecimal getDepth() {
		return depth;
	}

	public void setDepth(BigDecimal depth) {
		this.depth = depth;
	}

	public Manage getManage() {
		return manage;
	}

	public void setManage(Manage manage) {
		this.manage = manage;
	}

	public List<ShopSupporting> getShopSupportings() {
		return shopSupportings;
	}

	public void setShopSupportings(List<ShopSupporting> shopSupportings) {
		this.shopSupportings = shopSupportings;
	}

	public List<ShopBusinessType> getManageBusinessTypes() {
		return manageBusinessTypes;
	}

	public void setManageBusinessTypes(List<ShopBusinessType> manageBusinessTypes) {
		this.manageBusinessTypes = manageBusinessTypes;
	}

	public List<ShopBusinessType> getFitBusinessTypes() {
		return fitBusinessTypes;
	}

	public void setFitBusinessTypes(List<ShopBusinessType> fitBusinessTypes) {
		this.fitBusinessTypes = fitBusinessTypes;
	}

	public String getLeftNearName() {
		return leftNearName;
	}

	public void setLeftNearName(String leftNearName) {
		this.leftNearName = leftNearName;
	}

	public List<ShopBusinessType> getLeftNearBusinessTypes() {
		return leftNearBusinessTypes;
	}

	public void setLeftNearBusinessTypes(List<ShopBusinessType> leftNearBusinessTypes) {
		this.leftNearBusinessTypes = leftNearBusinessTypes;
	}

	public String getRightNearName() {
		return rightNearName;
	}

	public void setRightNearName(String rightNearName) {
		this.rightNearName = rightNearName;
	}

	public List<ShopBusinessType> getRightNearBusinessTypes() {
		return rightNearBusinessTypes;
	}

	public void setRightNearBusinessTypes(List<ShopBusinessType> rightNearBusinessTypes) {
		this.rightNearBusinessTypes = rightNearBusinessTypes;
	}

	public String getImgs() {
		return imgs;
	}

	public void setImgs(String imgs) {
		this.imgs = imgs;
	}

	public String getSuperiority() {
		return superiority;
	}

	public void setSuperiority(String superiority) {
		this.superiority = superiority;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public ShopStatus getShopStatus() {
		return shopStatus;
	}

	public void setShopStatus(ShopStatus shopStatus) {
		this.shopStatus = shopStatus;
	}

	public PublicType getPublicType() {
		return publicType;
	}

	public void setPublicType(PublicType publicType) {
		this.publicType = publicType;
	}

	public User getInputer() {
		return inputer;
	}

	public void setInputer(User inputer) {
		this.inputer = inputer;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getShopNumber() {
		return shopNumber;
	}

	public void setShopNumber(String shopNumber) {
		this.shopNumber = shopNumber;
	}

	public Date getDueTime() {
		return dueTime;
	}

	public void setDueTime(Date dueTime) {
		this.dueTime = dueTime;
	}

	public OwnerType getOwnerType() {
		return ownerType;
	}

	public void setOwnerType(OwnerType ownerType) {
		this.ownerType = ownerType;
	}

	public String getOwnerName() {
		return ownerName;
	}

	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

	public String getOwnerPhone() {
		return ownerPhone;
	}

	public void setOwnerPhone(String ownerPhone) {
		this.ownerPhone = ownerPhone;
	}

	public String getOwnerWeChat() {
		return ownerWeChat;
	}

	public void setOwnerWeChat(String ownerWeChat) {
		this.ownerWeChat = ownerWeChat;
	}

	public String getSourceName() {
		return sourceName;
	}

	public void setSourceName(String sourceName) {
		this.sourceName = sourceName;
	}

	public String getAreaText() {
		return areaText;
	}

	public void setAreaText(String areaText) {
		this.areaText = areaText;
	}

	public CrawlerStatus getCrawlerStatus() {
		return crawlerStatus;
	}

	public void setCrawlerStatus(CrawlerStatus crawlerStatus) {
		this.crawlerStatus = crawlerStatus;
	}

	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	public CreateType getCreateType() {
		return createType;
	}

	public void setCreateType(CreateType createType) {
		this.createType = createType;
	}

	public SysAccount getVerificationAccount() {
		return verificationAccount;
	}

	public void setVerificationAccount(SysAccount verificationAccount) {
		this.verificationAccount = verificationAccount;
	}

	public Date getDistributionTime() {
		return distributionTime;
	}

	public void setDistributionTime(Date distributionTime) {
		this.distributionTime = distributionTime;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public Boolean getViewFlag() {
		return viewFlag;
	}

	public void setViewFlag(Boolean viewFlag) {
		this.viewFlag = viewFlag;
	}
	
	
}
